package cn.itcast.order.configuration;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

@Configuration
@ConfigurationProperties(prefix = "userservice")
@Data
public class QuartzProperties {

    private Scheduler scheduler = new Scheduler();
    private JobStore jobStore = new JobStore();
    private ThreadPool threadPool = new ThreadPool();
    private DataSourceProperties dataSource = new DataSourceProperties();

    public static class Scheduler {
        private String instanceName;
        private String instanceId;
        private long misfireThreshold;

        public String getInstanceName() {
            return instanceName;
        }

        public void setInstanceName(String instanceName) {
            this.instanceName = instanceName;
        }

        public String getInstanceId() {
            return instanceId;
        }

        public void setInstanceId(String instanceId) {
            this.instanceId = instanceId;
        }

        public long getMisfireThreshold() {
            return misfireThreshold;
        }

        public void setMisfireThreshold(long misfireThreshold) {
            this.misfireThreshold = misfireThreshold;
        }
    }

    public static class JobStore {
        private String clazz;
        private String driverDelegateClass;
        private boolean useProperties;
        private String dataSource;
        private String tablePrefix;
        private boolean isClustered;

        public String getClazz() {
            return clazz;
        }

        public void setClazz(String clazz) {
            this.clazz = clazz;
        }

        public String getDriverDelegateClass() {
            return driverDelegateClass;
        }

        public void setDriverDelegateClass(String driverDelegateClass) {
            this.driverDelegateClass = driverDelegateClass;
        }

        public boolean isUseProperties() {
            return useProperties;
        }

        public void setUseProperties(boolean useProperties) {
            this.useProperties = useProperties;
        }

        public String getDataSource() {
            return dataSource;
        }

        public void setDataSource(String dataSource) {
            this.dataSource = dataSource;
        }

        public String getTablePrefix() {
            return tablePrefix;
        }

        public void setTablePrefix(String tablePrefix) {
            this.tablePrefix = tablePrefix;
        }

        public boolean isClustered() {
            return isClustered;
        }

        public void setClustered(boolean clustered) {
            isClustered = clustered;
        }
    }

    public static class ThreadPool {
        private String clazz;
        private int threadCount;
        private int threadPriority;

        public String getClazz() {
            return clazz;
        }

        public void setClazz(String clazz) {
            this.clazz = clazz;
        }

        public int getThreadCount() {
            return threadCount;
        }

        public void setThreadCount(int threadCount) {
            this.threadCount = threadCount;
        }

        public int getThreadPriority() {
            return threadPriority;
        }

        public void setThreadPriority(int threadPriority) {
            this.threadPriority = threadPriority;
        }
    }

    public static class DataSourceProperties {
        private MyDS myDS = new MyDS();

        public MyDS getMyDS() {
            return myDS;
        }

        public void setMyDS(MyDS myDS) {
            this.myDS = myDS;
        }

        public static class MyDS {
            private String driver;
            private String url;
            private String username;
            private String password;
            private int maxConnections;
            private String validationQuery;

            public String getDriver() {
                return driver;
            }

            public void setDriver(String driver) {
                this.driver = driver;
            }

            public String getUrl() {
                return url;
            }

            public void setUrl(String url) {
                this.url = url;
            }

            public String getUsername() {
                return username;
            }

            public void setUsername(String username) {
                this.username = username;
            }

            public String getPassword() {
                return password;
            }

            public void setPassword(String password) {
                this.password = password;
            }

            public int getMaxConnections() {
                return maxConnections;
            }

            public void setMaxConnections(int maxConnections) {
                this.maxConnections = maxConnections;
            }

            public String getValidationQuery() {
                return validationQuery;
            }

            public void setValidationQuery(String validationQuery) {
                this.validationQuery = validationQuery;
            }
        }

    }

    public Scheduler getScheduler() {
        return scheduler;
    }

    public void setScheduler(Scheduler scheduler) {
        this.scheduler = scheduler;
    }

    public JobStore getJobStore() {
        return jobStore;
    }

    public void setJobStore(JobStore jobStore) {
        this.jobStore = jobStore;
    }

    public ThreadPool getThreadPool() {
        return threadPool;
    }

    public void setThreadPool(ThreadPool threadPool) {
        this.threadPool = threadPool;
    }

    public DataSourceProperties getDataSource() {
        return dataSource;
    }

    public void setDataSource(DataSourceProperties dataSource) {
        this.dataSource = dataSource;
    }
}